import 'package:gzmall_app/model/picture.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:gzmall_app/model/p_option_value.dart';

part 'p_skus.g.dart';

@JsonSerializable()
class PSkus extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'name')
  String name;

  @JsonKey(name: 'cost_price')
  String costPrice;

  @JsonKey(name: 'sale_price')
  String salePrice;

  @JsonKey(name: 'promotion_price')
  String promotionPrice;

  @JsonKey(name: 'option_values')
  List<POptionValue> optionValues;

  @JsonKey(name: 'sku_images')
  List<Picture> skuImages;

  @JsonKey(name: 'avatar')
  String avatar;

  @JsonKey(name: 'on_hand_count')
  String onHandCount;

  PSkus(
    this.id,
    this.name,
    this.costPrice,
    this.salePrice,
    this.optionValues,
    this.skuImages,
    this.promotionPrice,
    this.onHandCount,
    this.avatar,
  );

  factory PSkus.fromJson(Map<String, dynamic> srcJson) =>
      _$PSkusFromJson(srcJson);

  Map<String, dynamic> toJson() {
    return _$PSkusToJson(this);
  }
}
